using System.Collections.Generic;
using System.Data.SqlClient;

namespace Twipler.Data.Cache
{
	public abstract class TwitterId : IReadWriteTableStore
	{
		public int Id { get; set; }
        
		public virtual int ColumnCount { get { return 1; } }
		public virtual List<TableColumn> Columns { get { return new List<TableColumn>() { new TableColumn(true, "TwitterId", "int not null PRIMARY KEY CLUSTERED", "@TwitterId") }; } }
    	
		public virtual int TableNameParamCount { get { return 0; } } 
		public abstract string TableName { get; } 

		public virtual void FromSqlDataReader(SqlDataReader sqlReader)
		{
			Id = (int)sqlReader["TwitterId"];
		}

		public virtual void AddParameters(SqlCommand command)
		{
			command.Parameters.Add("TwitterId", System.Data.SqlDbType.Int).Value = Id;
		}
        
		public virtual void QueryParams(SqlCommand command, params object[] args)
		{
			if (args.Length > 0)
				command.Parameters.Add("@TwitterId", System.Data.SqlDbType.Int).Value = (int) args[0];
		}
	}
}